/// Read something from the address.
pub fn read_from_addr<T>(addr: usize) -> T {
    unsafe { (addr as *const T).read() }
}

pub fn addr_to_mut_ref<T>(addr: usize) -> &'static mut T {
    unsafe { &mut *(addr as *mut T) }
}

/// Returns a mutable reference to the array on the address.
pub fn addr_to_array<T>(addr: usize, len: usize) -> &'static mut [T] {
    unsafe { core::slice::from_raw_parts_mut(addr as *mut T, len) }
}
